Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "karmor profile --save" command #472

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

Affan-7
Copy link

@Affan-7 Affan-7 commented Dec 15, 2024

Fixes #381

@Affan-7
Copy link
Author

Affan-7 commented Dec 15, 2024

Output:

image

@Affan-7
Copy link
Author

Affan-7 commented Dec 15, 2024

@daemon1024

Sir, can you please review this. Let me know if this require any changes, I would love to learn about the best practices.

Aryan-sharma11
Aryan-sharma11 previously approved these changes Dec 17, 2024
Copy link
Member

@Aryan-sharma11 Aryan-sharma11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works, tested locally. @Affan-7 kindly fix the ci-gosec failures

@Affan-7
Copy link
Author

Affan-7 commented Dec 17, 2024

@Aryan-sharma11 fixed the gosec failure.

Aryan-sharma11
Aryan-sharma11 previously approved these changes Dec 18, 2024
Copy link
Member

@daemon1024 daemon1024 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's reuse and refactor functions from recommend directory into utils to avoid complications and duplicate code

func createOutDir(dir string) error {

err := os.MkdirAll(filepath, 0600)
err = os.WriteFile(filepath+Operation+".json", []byte(jsonArray[0]), 0600)
directory := "Profile_Summary/"
err := os.MkdirAll(directory, 0700)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
err := os.MkdirAll(directory, 0700)
err := os.MkdirAll(directory, 0600)

Why do we need exec permission?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without exec we can't cd into that directory, and we also can't create files. Here is the current behavior of 600 permission:

image

profile/Client/profileClient.go Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: P1- PR Ready for review
Development

Successfully merging this pull request may close these issues.

--save command is broken in karmor profile
3 participants